//
//  SZYHInvestingAndFinancingViewController.m
//  苏州银行
//
//  Created by rimi on 15/8/20.
//  Copyright (c) 2015年 IOS. All rights reserved.
//

#import "SZYHInvestingAndFinancingViewController.h"
#import "NetworkRequest.h"
@interface SZYHInvestingAndFinancingViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property (weak, nonatomic) IBOutlet UIWebView *webView;
@property (assign,nonatomic) BOOL selecte;
@end

@implementation SZYHInvestingAndFinancingViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    
    _tableView.delegate = self;
    _tableView.dataSource = self;
    [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"CELL"];
    
    [self.view bringSubviewToFront:_tableView];
    _tableView.alpha = 0;
    
    [self netWorkingRequest];
    
    _selecte = NO;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (IBAction)categoryEvent:(UIButton *)sender {
//    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
    
        _tableView.backgroundColor = [UIColor redColor];
    
    
        _selecte = !_selecte;
        if (_selecte == YES) {
            
//            _tableView.center = CGPointMake(322.5, 150);
            NSLog(@"%@",NSStringFromCGPoint(_tableView.center));
//            [UIView animateWithDuration:3 animations:^{
//                
//                _tableView.alpha = 1;
//                _tableView.center = CGPointMake(322.5, 270);
//                
//            }];
            
            [UIView animateWithDuration:1 animations:^{
                _tableView.alpha = 1;
                _tableView.center = CGPointMake(322.5, 270);
            } completion:^(BOOL finished) {
                NSLog(@"----%@",NSStringFromCGPoint(_tableView.center));
            }];
            
        }else if (_selecte == NO) {
            NSLog(@"===%@",NSStringFromCGPoint(_tableView.center));
            
            [UIView animateWithDuration:1 animations:^{
                _tableView.alpha = 0;
                _tableView.frame = CGRectMake(16, 0, 613, 297);
                
            }];
            
        }
//    });
    
  
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 7;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CELL"];
    if (!cell) {
        cell = [[UITableViewCell alloc] init];
    }
    cell.text = @"1";
    cell.backgroundColor = [UIColor greenColor];
    return cell;
}
- (void)netWorkingRequest
{
    NSDictionary *para = @{@"time":@""};
    [NetworkRequest POST:@"protocol_gold_pomegranate_type!update.action" parameters:para success:^(id respondseObject) {
        NSLog(@"%@",respondseObject);
        [self.webView loadHTMLString:respondseObject[@"datalist"][0][@"INTO"] baseURL:nil];
    } failure:^(NSError *error) {
        
    }];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
